<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.js"></script>
</head>

<body>
    作业1：输入框和密码的切换

    <div id="app">


        {{mag}}：<input :type="type">

        <hr>

        <button @click="pwdOrTxt">切换{{mag}}</button>


    </div>


    <script>


        new Vue({
            el: '#app',
            data: {
                mag: '输入框',
                type: 'text',
                flag: true,
            },
            methods: {
                pwdOrTxt() {
                    this.type = (this.flag) ? 'test' : 'password';
                    this.mag = (this.flag)?'输入框':'密码框';
                    this.flag = !this.flag;
                }
            }
        })

    </script>

</body>

</html>